import React, { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { getTopic } from "./actions";

const Home = () => {
    const dispatch = useDispatch();
    const { topics } = useSelector((state) => state.b);
    console.log(topics);
    useEffect(() => {
        dispatch(getTopic());
    });
    return (
        <div>
            <ul>
                {topics.map((item, index) => (
                    <li key={item.id}>{item.title}</li>
                ))}
            </ul>
        </div>
    );
};

export default Home;
